<%@ page import="com.luojiaoj.news.News" %>
<!doctype html>
<html>
<head>
    <meta name="layout" content="OJMain">
    <title><g:message code="ljoj.onlinejudge.news.list.title" default="news" /></title>
    <r:require modules="news" />
</head>

<body>
<div id="list-news" class="content scaffold-list" role="main">
    <div class="titleHeader offset1">
        <h3><g:message code="ljoj.onlinejudge.news.list.title" default="news" /></h3>
    </div>
    <div class="newsContain offset1 span10 hero-unit">
        <table class="table">
            <thead>
            <tr>

                <g:sortableColumn property="title" title="${message(code: 'ljoj.onlinejudge.news.title.label', default: 'Title')}"/>

                <th><g:message code="ljoj.onlinejudge.news.creator.label" default="Creator"/></th>

                <g:sortableColumn property="dateCreated"
                                  title="${message(code: 'ljoj.onlinejudge.news.dateCreated.label', default: 'Date Created')}"/>

                <g:sortableColumn property="lastUpdated"
                                  title="${message(code: 'ljoj.onlinejudge.news.lastUpdated.label', default: 'Last Updated')}"/>

            </tr>
            </thead>
            <tbody>
            <g:each in="${newsInstanceList}" status="i" var="newsInstance">
                <tr class="${(i % 2) == 0 ? 'even' : 'odd'}">

                    <td><g:link action="show"
                                id="${newsInstance.id}">${fieldValue(bean: newsInstance, field: "title")}</g:link></td>

                    <td>${fieldValue(bean: newsInstance, field: "creator")}</td>

                    <td><g:formatDate date="${newsInstance.dateCreated}"/></td>

                    <td><g:formatDate date="${newsInstance.lastUpdated}"/></td>

                </tr>
            </g:each>
            </tbody>
        </table>

        <div class="pagination">
            <g:paginate total="${newsInstanceTotal}"/>
        </div>
        <div class="addNews btn btn-primary">
            <a href="${createLink(action: 'create')}">
                <g:message code="ljoj.onlinejudge.news.add.label" default="add news" />
            </a>
        </div>
    </div>
</div>
</body>
</html>
